<?php

//TODO 备用
namespace app\admin\controller;

class SiteInfo extends Common
{
    public function index(){
        return view();
    }
    public function carousel(){
        return view();
    }
    public function uploadImg(){
        // 获取表单上传文件 例如上传了001.jpg
        $file = request()->file('file');
        $arr= array();

        // 移动到框架应用根目录/public/uploads/ 目录下
        if($file){
            $info =$file->move(ROOT_PATH . '/uploads/images/carousel');
            $arr['type']=1;
            $url='/uploads/images/carousel/'.$info->getSaveName();
            $arr['url']=str_replace('\\','/',$url);
            return $arr;//type为1上传成功
        }else{
            $arr['type']=2;
            return $arr;//type为2上传失败
        }
    }
}